﻿<%@ Register Namespace="CustomWebControls" TagPrefix="CustomControls" Assembly="Nivdal" %>
<%@ Page Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" Inherits="Nivdal.AdminAddNews" Title=""
    StylesheetTheme="SkinFile" Codebehind="AdminAddNews.aspx.cs" %>

<asp:Content ID="PageNameContent" ContentPlaceHolderID="PageNamePlaceHolder" runat="server">
    <asp:Label ID="PageNameLabel" runat="server" Text="<%$ Resources:Resource, AdminAddNews_PageNameLabel %>" CssClass="PageNameContentStyle"></asp:Label>
</asp:Content>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    <div class="basic_element">
    <div class="red_title">
       <asp:Label ID="PageTitleLabelLabel" runat="server"  Text="<%$ Resources:Resource, AdminAddNews_PageNameLabel %>" CssClass="white_title"></asp:Label>
    </div>
    <div class="padding5">

        <asp:Label ID="MessageLabel" runat="server" Text="" SkinID="ErrorLabel"></asp:Label>
        <asp:Label ID="PreferredLanguageTitleLabel" Text="<%$ Resources:Resource, AdminAddNews_PreferredLanguageTitleLabel %>" runat="server" SkinID="InfoLabel"></asp:Label>
        <br />
        <asp:DropDownList ID="LanguageDropDownList" runat="server" DataTextField="Language_Name"
            DataValueField="Language_Code" DataSourceID="LanguageSqlDataSource"  CssClass="rounded_corners">
        </asp:DropDownList>
        <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="LanguageDropDownList"
            ErrorMessage="*" Height="16px" InitialValue="1" ValidationGroup="AdminNews"
            Style="margin-right: 0px" Width="16px"></asp:RequiredFieldValidator>
        <asp:SqlDataSource ID="LanguageSqlDataSource" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
            SelectCommand="SELECT [Language_Name], [Language_Code] FROM [Nivdal_Languages]">
        </asp:SqlDataSource>
        <br /><br />
        <asp:Label ID="NationalityLabel"  runat="server" Text="<%$ Resources:Resource, AdminAddNews_NationalityLabel %>" SkinID="InfoLabel"></asp:Label>
        <br />
        <asp:DropDownList ID="NationalityDropDownList" runat="server" DataSourceID="NationalitiesSqlDataSource"
            DataTextField="Name" DataValueField="Id"  CssClass="rounded_corners">
        </asp:DropDownList>
        <asp:SqlDataSource ID="NationalitiesSqlDataSource" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
            SelectCommand="SELECT [Name], [Id] FROM [Nivdal_Country]"></asp:SqlDataSource>
        <br /><br />
        
        <asp:CheckBox ID="TranslationNeededCheckBox" runat="server" Text="Translation needed" 
            Checked="true" CssClass="NewsItemStyle" />
        <br /><br />
        <asp:Label ID="TitleLabel" runat="server" Text='<%# Resources.Resource.Global_Title+ ":"%>' SkinID="InfoLabel"></asp:Label>
        <br />
        <asp:TextBox ID="txtTName" runat="server" MaxLength="100"></asp:TextBox>
        &nbsp;
        <asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" 
        ErrorMessage="<%$ Resources:Resource, AdminAddNews_RequiredFieldValidator3 %>" ControlToValidate="txtTName" 
        SetFocusOnError="True" ValidationGroup="AdminNews"></asp:RequiredFieldValidator>
        <br /><br />
        <asp:Label ID="NewsContentLabel" runat="server" Text="<%$ Resources:Resource, AdminAddNews_NewsContentLabel %>" SkinID="InfoLabel"></asp:Label>
            <br />
            <CustomControls:TextArea runat="server" ID="NewsTextArea" MaxLength="4000" TextMode="MultiLine"
            Rows="3" Height="250px" Width="360px"></CustomControls:TextArea>
            <br />
            <br />
            <asp:Button ID="SubmitAdminNewsButton" runat="server" Text="<%$ Resources:Resource, Global_Submit %>"  ValidationGroup = "AdminNews" OnClick="Button1_Click"
             CssClass="GreenButtonTextStyle" />

        <br /><hr /><br />
        <asp:Label ID="PendingTranslationTitleLabel" runat="server" SkinID="SubHeaderLabel" Text="News items pending translation:"></asp:Label>
        <br />
        <asp:Repeater ID="TranslationRepeater" runat="server" DataSourceID="PendingTranslateDataSource" OnItemCommand="ApproveItem">
            <ItemTemplate>
                <asp:Label ID="NewsTitleLabel" runat="server" Text='<%# Eval("Title") %>' SkinID="GridLabel"></asp:Label>
                <asp:HiddenField ID="NewsIdHiddenfield" runat="server" Value='<%# Eval("NewsItemId") %>' />
                <br />
                <asp:GridView ID="LanguagesGrid" runat="server" DataSourceID="LanguagesDS" SkinID="Professional" 
                 AutoGenerateColumns="false" AllowPaging="false">
                    <Columns>
                        <asp:TemplateField>
                            <ItemTemplate>
                                <asp:Label ID="LanguageNameLabel" runat="server" SkinID="GridLabel" Text='<%# Eval("Language_Name") %>'></asp:Label>
                            </ItemTemplate>                            
                        </asp:TemplateField>
                        <asp:TemplateField>
                            <ItemTemplate>
                                <asp:Image ID="ApprovedImage" runat="server" ToolTip='<%# Eval("TranslatedText") %>'
                                 ImageUrl='<%# (Eval("TranslatedText").ToString().Length > 0) ? "~/Images/Icons/vi.png" : "~/Images/Icons/delete.png" %>' />
                            </ItemTemplate>
                        </asp:TemplateField>
                    </Columns>                    
                </asp:GridView>
                <asp:Button ID="ApproveButton" runat="server" Text="Approve" CommandArgument='<%# Eval("NewsItemId") %>'
                 CommandName="Approve" CssClass="GreenSmallButtonStyle" />
                <asp:SqlDataSource ID="LanguagesDS" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
                    SelectCommand="Nivdal_GetNewsItemTranslationStatus" SelectCommandType="StoredProcedure">
                    <SelectParameters>
                        <asp:ControlParameter ControlID="NewsIdHiddenfield" PropertyName="Value" Name="NewsItemId" />
                    </SelectParameters>
                </asp:SqlDataSource>
        
            </ItemTemplate>
            <SeparatorTemplate>
                <br /><hr /><br />
            </SeparatorTemplate>
        </asp:Repeater>
        <br /><br />
        <asp:SqlDataSource ID="PendingTranslateDataSource" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
            SelectCommand="Nivdal_GetNewsItemsPendingTranslation" SelectCommandType="StoredProcedure"></asp:SqlDataSource>
    </div>
    </div>
            
</asp:Content>
